57b09b37b4f6a83228aee10096fd2ce81a6c8551,underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AUnderFileSystem.java,S3AUnderFileSystem,isFolder,#String#,510

Before Change


   */
  private boolean isFolder(String key) {
    // Root is always a folder
    if (isRoot(key)) {
      return true;
    }
    try {
      String keyAsFolder = convertToFolderName(stripPrefixIfPresent(key));
      mClient.getObjectMetadata(mBucketName, keyAsFolder);
      // If no exception is thrown, the key exists as a folder
      return true;
    } catch (AmazonClientException e) {
      // It is possible that the folder has not been encoded as a _$folder$ file
      try {
        String dir = stripPrefixIfPresent(key);
        String dirPrefix = PathUtils.normalizePath(dir, PATH_SEPARATOR);
        // Check if anything begins with <folder_path>/
        ObjectListing objs = mClient.listObjects(mBucketName, dirPrefix);
        // If there are, this is a folder and we can create the necessary metadata
        if (objs.getObjectSummaries().size() > 0) {
          mkdirsInternal(dir);
          return true;
        } else {
          return false;
        }
      } catch (AmazonClientException ace) {
        return false;

After Change


   */
  private boolean isFolder(String key) {
    // Root is always a folder
    return isRoot(key) || getFolderMetadata(key) != null;
  }

  /**